package evo.springboot.controller;


import evo.springboot.model.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
public class StudentController {


    @RequestMapping(value = "/test")
    @ResponseBody
    public Object test(Integer id,Integer age){
        Student student = new Student();
        student.setId(id);
        student.setAge(age);
        return student;
    }

    @RequestMapping(value = "/test2/detail/{id}/{age}")
    @ResponseBody
    public Object test2(@PathVariable("id") Integer id,@PathVariable("age") Integer age){
        Map<String,Object> retMap = new HashMap();
        retMap.put("id",id);
        retMap.put("age",age);
        return retMap;
    }
}
